package com.qyer.log;

import static com.qyer.search.Constants.SEPARATOR2;

import com.qyer.search.Constants;
import com.qyer.search.model.SearchParameter;
import com.qyer.search.model.SearchParameterOrigin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * User: Z J Wu Date: 2015/08/28 Time: 22:29 Package: com.qyer.log
 */
public class DebugLogger {

  private static final Logger LOGGER = LoggerFactory.getLogger(DebugLogger.class);

  public static void logDebug(SearchParameter searchParameter, Object o) {
    StringBuilder sb = new StringBuilder();
    sb.append(searchParameter.getRequestId());
    sb.append(SEPARATOR2);
    sb.append(searchParameter.getContext());
    sb.append(SEPARATOR2);

    if (o == null) {
      sb.append(SEPARATOR2);
    } else {
      sb.append(o.getClass().getSimpleName());
      sb.append(SEPARATOR2);
      sb.append(Constants.DEFAULT_GSON.toJson(o));
    }

    LOGGER.debug(sb.toString());
  }

}


